package com.example.demo.test.controller;


import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.example.demo.test.entity.Gsmdata;
import com.example.demo.test.service.IGsmdataService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.sql.SQLOutput;
import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author auth
 * @since 2021-07-01
 */
@RestController
@RequestMapping("/test/gsmdata")
public class GsmdataController {

    @Autowired
    private IGsmdataService gsmdataService;

    @GetMapping("/get")
    @ApiOperation(value = "获取学生列表")
    @Cacheable(value = "userCache", key = "1000", sync = true)
    public List<Gsmdata> getGsmData() {
        LambdaQueryWrapper<Gsmdata> query = Wrappers.lambdaQuery(Gsmdata.class);
        return gsmdataService.list(query);
    }
    @GetMapping("/test")
    @ApiOperation(value = "测试")
    public List<String> getTest() {
        String str = "[\"SENDERNAME,SENDERPHONE,SENDERADDRESS,SENDERCARD\",\"RECEIVERNAME,RECEIVERPHONE,RECEIVERADDRESS,RECEIVERIDCARDNUM\"]";
        List<String> list = JSON.parseArray(str, String.class);
        list.forEach(System.out::println);
        return list;
    }

}

